package com.lma.crm.utils;

import java.math.BigInteger;
import java.security.MessageDigest;

public class MyStringUtils {

	/**
	 * 字符串MD5加密
	 * @param value
	 * @return
	 */
	public static String getMD5Value(String value) {
		try {
			//1.获得jdk提供信息摘要的算法工具类
			MessageDigest messageDigest = MessageDigest.getInstance("MD5");
			//2.获得加密结果：10进制
			byte[] md5ValueByteArray = messageDigest.digest(value.getBytes());
			//3.将十进制转换成十六进制
			BigInteger bigInteger = new BigInteger(1, md5ValueByteArray);
			return bigInteger.toString(16);
			
		} catch (Exception e) {
			throw new RuntimeException(e);
		} 
		
	}
	
}
